From 44b5c4654b6beb36c6cabcd545953e825315eb9b Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 11 Sep 2013 07:46:08 +0000 Subject: [PATCH] Fix mem leak I introduced earlier tonight (this morning?) in ozi. --- gpsbabel/ozi.cc | 13 +++++++------ gpsbabel/vitosmt.cc | 2 -- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gpsbabel/ozi.cc b/gpsbabel/ozi.cc index 2adc9ec3f..54467fe7e 100644 --- a/gpsbabel/ozi.cc +++ b/gpsbabel/ozi.cc @@ -324,19 +324,20 @@ ozi_route_hdr(const route_head* rte) static void ozi_route_disp(const waypoint* waypointp) { - double alt; char ozi_time[16]; route_wpt_count++; ozi_get_time_str(waypointp, ozi_time, sizeof(ozi_time)); +/* + double alt; if (waypointp->altitude == unknown_alt) { alt = -777; } else { alt = waypointp->altitude * alt_scale; } - +*/ /* * Field 1 : W - indicating route waypoint details. * Field 2 : Route Number - location in array of routes @@ -721,7 +722,6 @@ static void data_read(void) { QString buff; - char* s = NULL; char* trk_name = NULL; waypoint* wpt_tmp; int i; @@ -767,7 +767,7 @@ data_read(void) } } else if ((linecount == 5) && (ozi_objective == trkdata)) { int field = 0; - s = csv_lineparse(CSTR(buff), ",", "", linecount); + char* s = csv_lineparse(CSTR(buff), ",", "", linecount); while (s) { field ++; if (field == 4) { @@ -783,8 +783,8 @@ data_read(void) wpt_tmp = waypt_new(); /* data delimited by commas, possibly enclosed in quotes. */ - s = xstrdup(CSTR(buff)); - s = csv_lineparse(s, ",", "", linecount); + char* orig_s = xstrdup(CSTR(buff)); + char* s = csv_lineparse(orig_s, ",", "", linecount); i = 0; bool header = false; @@ -813,6 +813,7 @@ data_read(void) i++; s = csv_lineparse(NULL, ",", "", linecount); } + xfree(orig_s); switch (ozi_objective) { case trkdata: diff --git a/gpsbabel/vitosmt.cc b/gpsbabel/vitosmt.cc index f01cbaaef..cdc788ae7 100644 --- a/gpsbabel/vitosmt.cc +++ b/gpsbabel/vitosmt.cc @@ -318,13 +318,11 @@ vitosmt_waypt_pr(const waypoint* waypointp) static void vitosmt_write(void) { - time_t now = 0; unsigned char* workbuffer =0; size_t position =0; workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1); - now = current_time().toTime_t(); count = 0; position = 0; -- 2.30.2